{% assign page_url_path = page.url | regex_replace: '/index$|/index\.html$|\.html$|/$' | prepend: '/*' | append: '/' -%}

<nav id="mainnav" class="site-header">
  <div id="menu-toggle"><i class="material-icons">menu</i></div>
  <a href="/" class="brand" title="{{site.title}}">
    <img src="{% asset shared/dart/logo+text/horizontal/white.svg @path %}" alt="{{site.title}}">
  </a>
  <ul class="navbar">
    {%- comment -%}
      If you edit this list, also edit navigation-side.html (mobile).
    {% endcomment %}
    <li>
      <a href="/overview" class="nav-link
        {%- if page_url_path contains '/*/overview/' %} active {%- endif -%}">概览</a>
    </li>
    <li class="mainnav__get-started">
      <a href="/guides" class="nav-link
        {%- if page_url_path contains '/*/guides/' or page_url_path contains '/*/dart-2/' or page_url_path contains '/*/codelabs/' or page_url_path contains '/*/samples/' or page_url_path contains '/*/tools/' or page_url_path contains '/*/tutorials/' or page_url_path contains '/*/server/' or page_url_path contains '/*/web/' %} active {%- endif -%}"><span>Docs</span></a>
    </li>
    <li>
      <a href="/community" class="nav-link
        {%- if page_url_path contains '/*/community/' %} active {%- endif -%}">社区</a>
    </li>
    <li>
      <a href="https://dartpad.cn" target="_blank" class="nav-link no-automatic-external 
        {%- if page_url_path contains '/*/#dartpad' %} active {%- endif -%}">尝试 Dart</a>
    </li>
    <li>
      <a href="/get-dart" class="nav-link
        {%- if page_url_path contains '/*/get-dart/' %} active {%- endif -%}">获取 Dart SDK</a>
    </li>
    <li class="searchfield">
      <form action="/search" class="site-header__search form-inline" id="cse-search-box">
        <input type="hidden" name="cx" value="011220921317074318178:_yy-tmb5t_i">
        <input type="hidden" name="ie" value="UTF-8">
        <input type="hidden" name="hl" value="en">
        <input class="site-header__searchfield form-control" type="search" name="q" id="q" autocomplete="off" placeholder="搜索" aria-label="Search">
      </form>
    </li>
  </ul>
</nav>
